import { baseRequestClient, requestClient } from '#/api/request';
import http from '../http/index';

/**
 * 登录
 */
export async function loginApi(data: any) {
  return http.post('/user/login', data);
  // return requestClient.post('/user/login', data);
}

/**
 * 刷新accessToken
 */
export async function refreshTokenApi() {
    return baseRequestClient.post('/auth/refresh', {
        withCredentials: true,
    });
}

/**
 * 退出登录
 */
export async function logoutApi() {
    // /auth/logout
    return http.post('/user/logout', {
        token: 'a41df41b7e714e91a0b9999fea5b3524',
    });
}

/**
 * 获取用户权限码
 */
export async function getAccessCodesApi() {
    return requestClient.get<string[]>('/auth/codes');
}
